﻿<?php
defined('IN_DESTOON') or exit('Access Denied');
include tpl('header');
show_menu($menus);
extract($datalist[$id]);
?>
<form method="post" action="?" id="dform" onsubmit="return check();">
<input type="hidden" name="moduleid" value="<?php echo $moduleid;?>"/>
<input type="hidden" name="file" value="<?php echo $file;?>"/>
<input type="hidden" name="action" value="<?php echo $action;?>"/>
<input type="hidden" name="id" value="<?php echo $id;?>"/>
<input type="hidden" name="forward" value="<?php echo $forward;?>"/>
<div class="tt"><?php echo $name;?></div>
<table width="100%" cellpadding="2" cellspacing="1" class="tb">
<?php if($pid==0){?>
<tr>
<td align="right" class="tl"><span class="f_red">*</span>供应大分类</td>
<td >
<select name="catid">
<?php
            foreach($_category as $k=>$v){
			if($v['parentid']==0)
			{
?>
	<option value="<?php echo $v['catid'];?>" <? if ($v['catid']==$catid){?> disabled="disabled"<? }?>><?php echo $v['catname'];?></option>
    <?php
            }
            }
 ?>
 </select>
</td>
</tr>
<tr>
<td align="right" class="tl"><span class="f_red">*</span> 字段名称（英文，非专业人士请勿修改）</td>
<td><input name="name"  id="tb" value="<?=$tb?>"/><span id="dtb" class="f_red"></span></td>
</tr>
<?php }?>
<?php if($pid){?>
<tr>
<td align="right" class="tl"><span class="f_red">*</span>大分类</td>
<td >
<select name="pid">
	<option value="0">顶级分类</option>
<?php
            foreach($datalist as $k=>$v){
			if($v['pid']==0)
			{
?>
	<option value="<?php echo $v['id'];?>" <? if ($v['id']==$id){?> disabled="disabled"<? }?> <? if ($v['id']==$pid){?> selected="selected"<? }?>><?php echo $v['name'];?></option>
    <?php
            }
            }
 ?>
 </select>
</td>
</tr>

<?php }?>
<tr>
<td align="right" class="tl"><span class="f_red">*</span> 名称</td>
<td><input name="name"  id="name" value="<?=$name?>"/><span id="dname" class="f_red"></span></td>
</tr>
<tr>
        <td>&nbsp;&nbsp;        </td>
        <td><input value="提交" name="submit" id="submit" type="submit" />
        <input type="reset" name="reset" id="reset" value="重置" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
function check() {
	var l;
	var f;
	f = 'name';
	l = Dd(f).value.length;
	if(l < 2) {
		Dmsg('名称最少2字，当前已输入'+l+'字', f);
		return false;
	}
	return true;
}
</script>
<?php include tpl('footer');?>